package com.czk.ssalocalmcpserver.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * @Author: chenzhangkun
 * @CreateTime: 2025-11-03
 * @Description:
 * @Version: 1.0
 */
@Service
@Slf4j
public class WeatherService {

    @Tool(description = "根据城市名称获取天气预报")
    public String getWeatherByCity(@RequestParam(value = "city", defaultValue = "上海") String city) {
        log.info("开始查询天气，请求参数:{}", city);
        Map<String, String> map = Map.of("成都", "20度", "上海", "30度", "北京", "40度");
        log.info("查询天气结束");
        return map.getOrDefault(city, "没有查询到数据");
    }


}
